package com.csun.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


/**
 * @ClassName: User.java
 * @Description:测试用户实体类
 * @author danjinsong danjingsong@dragonwake.cn
 * @date 2017年2月16日上午9:33:25
 * 
 */
@Entity
@Table(name="t_user")
@SuppressWarnings("serial")
public class User  implements Serializable{

    private Integer userId;								//ID主键
    private String userName;							//用户名
    private String password;							//密码	
    private Short userType;								//用户类型
    private String firstName;							//名字
    private String lastName;							//姓氏
    private String address;								//地址
    
    private Role role;									//角色
    //==================================================//
    /**
     * 无参构造器
     */
    public User() {
		super();
	}

	//==================================================//
    @Id
	@GeneratedValue(generator="_native")				//主键生成策略数组
	@GenericGenerator(name="_native",strategy="native") //引用策略数组中的native
	@Column(name = "userId", length=20)
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	@Column(name = "userName", length = 20)
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@Column(name = "password", length = 32)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	@Column(name = "userType")
	public Short getUserType() {
		return userType;
	}
	public void setUserType(Short userType) {
		this.userType = userType;
	}
	@Column(name = "firstName",length = 20)
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	@Column(name = "lastName",length = 20)
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	@Column(name = "address",length = 2000)
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	@ManyToOne
	@JoinColumn(name="u_roleId")
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	
}
